decorative banner

Render named items


    This script allows you to find compositions in the open project with a particular text string in their names and send all such compositions to the Render Queue.

    To start, we check to see if a default string for rendering has already been set in the user preferences. If so, we set this as a user prompt, handy if you're always looking for the same string (for example, "FINAL" or "CURRENT"). If not, we set a new sectionName and keyName for the preferences file along with a placeholder value for the string that will be entered by the user.

    var sectionName = "AE Example Scripts";
    var keyName = "Render comps with this string";
    var searchString = "";
    if (app.settings.haveSetting(sectionName, keyName)) {
        searchString = app.settings.getSetting(sectionName, keyName);
    }   

    Now we pop up a prompt to the user asking for what text string we should use.

    searchString = prompt("What string to render?", searchString);

    We next go through the project looking for the text entered by the user, and seeing if the item that contains that text is a composition, sending all compositions with that text string in their names to the Render Queue. If the user cancels, the text is undefined. Otherwise, we save the new setting in preferences, convert it to all lower case letters for consistency's sake (keeping in mind that the search will not be case sensitive).

    if (searchString) {
       
        app.settings.saveSetting(sectionName, keyName, searchString);
        searchString = searchString.toLowerCase();
        for (i = 1; i <= app.project.numItems; ++i) {
            var curItem = app.project.item(i);
            if (curItem instanceof CompItem) {
                if (curItem.name.toLowerCase().indexOf(searchString) != -1) {
                    app.project.renderQueue.items.add(curItem);
                }
            }
        }

    Finally, we make the Render Queue window visible and bring it to the front, ready for the user to assign save locations for the new render queue items.

        app.project.renderQueue.showWindow(true);
    }